package com.nokia.bpmn.provider.util;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * <p>HttpClient</p>
 *
 * @author cscz89@126.com
 */
@Configuration
public class HttpClient {

    @Bean
    public SimpleClientHttpRequestFactory httpClientFactory() {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setConnectTimeout(10000);
        factory.setReadTimeout(200000);
        return factory;
    }

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate(httpClientFactory());
    }
}